import request from "../utils/request";

// 课程列表
export interface ICourseParams {
  catelv1: string; //主类别
  catelv2?: string; //子类别
}
export const courseGet = (
  condition: ICourseParams = { catelv1: "63743fa51d35662164b31ad1" },
  page: number = 1
) => {
  let search = JSON.stringify(condition);
  // console.log(search);
  let skip = (page - 1) * 8;
  return request.get(
    `/classes/ReactAricle?where=${search}&limit=8&skip=${skip}`
  );
};

//课程详情
export const courseDetailGet = (objectId: string) => {
  return request.get(`/classes/ReactAricle/${objectId}`);
};

//课程分类
export const categoryGet = () => {
  return request.get("/classes/ReactCategory");
};
